// 对业务接口进行统一的管理
import {
	fetch
} from "./fetch.js"


// 对首页数据的请求
export const ApiGetHomeData = () => fetch('/index/index', {}, {}, 'GET');
//对专题页面数据请求
export const ApiGetTopicData = (params) => fetch('/topic/list', params, {}, 'GET');
// 注册
export const loginByWeb = (data) => fetch('/auth/loginByWeb', data, {}, 'POST');
// 分类信息
export const ApigetCategoryData = () => fetch('/catalog/index', {}, {}, 'GET');
// 获取当前分类的信息
export const ApigetCategoryCurrent = (id) => fetch('/catalog/current?id=' + id, {}, {}, 'GET');
// 购物车商品
export const ShoppingCartGoods = (token) => fetch('/cart/index', {}, {
	'X-Nideshop-Token': token
}, 'GET');

// 品牌详情页
export const ppxqy = (data) => fetch('/brand/detail', data, {}, 'GET')

// 新品详情页
export const xpxqy = (data) => fetch('/goods/detail', data, {}, 'GET')


export const xgcp = (data) => fetch('/goods/related', data, {}, 'GET')

// 搜索窗口数据
export const ApiSearchIndex = (params) => fetch('/search/index', {}, params, "GET");

// 实时搜索功能
export const ApiSearchHelper = (params) => fetch('/search/helper', {
	keyword: params.keyword
}, {
	'X-Nideshop-Token': params['X-Nideshop-Token']
}, "GET");

// 清除历史记录
export const ApiClearHistory = (params) => fetch('/search/clearhistory', {}, params);

// 搜索框商品搜索
export const ApiGetGoodsList = (params) => fetch('/goods/list', {
	keyword: params.keyword,
	page: 1,
	size: 20,
	order: params.order,
	categoryId: params.categoryId,
	sort: "price",

}, {
	'X-Nideshop-Token': params['X-Nideshop-Token']
}, "GET");
